package BasicModel.Element.Component;

import java.io.PrintWriter;
import java.util.*;

public class PhaseVariable extends ComplexVariable {
	
	String phaseSetName;
	//phaseSet instance's name
	String phaseVarName;
	
	LinkedList<String> phaseStateSet;
	String initPhase;

	public PhaseVariable(String name,  String phaseSetName,String initPhase) {
		super(name);
		this.dataStrucName = "Enum";
		this.initPhase = initPhase;
		this.phaseSetName = phaseSetName;
		this.phaseStateSet = new LinkedList<String>();
	}



	public void addPhaseElement(String phaseElement) {
		this.phaseStateSet.add(phaseElement);
	}

	// getter and setter

	public String getPhaseSetName() {
		return phaseSetName;
	}
	public String getPhaseVarName() {
		return this.getName();
	}

	public void WriteH(PrintWriter out) {
		out.printf("enum %s\n", this.phaseSetName);
		out.println("{");
		// all the phaseSet

		int num = 0;
		for (String phase : phaseStateSet) {
			out.printf("%s%s\n", (num++ == 0 ? "" : ","), phase);
		}

		out.println("};");

	}



	public String getInitPhase() {
		return initPhase;
	}



	public void setInitPhase(String initPhase) {
		this.initPhase = initPhase;
	}

}
